proc kick {nick handle chan host otbn1 botnet} {
  global botnick home bcast

  if {![botisop $chan]} {
    putquick "NOTICE $nick :\0034ERROR - Bot dosen't have op status (+o) on $chan"
    return 0
  } elseif {$otbn1 == ""} {
    putquick "NOTICE $nick :\0034ERROR - Invalid Syntax - Should Be - (/msg) $botnick kick <#channel> <nickname> <reason>"
    return 0
  } elseif {[string tolower $otbn1] == [string tolower $botnick]} {
    putquick "NOTICE $nick :Bot Unable To Kick Itself - Permission Denied."
    return 0
  } else {

    # if there is no one with the nickname "me" - allow use of the "me" keyword from StormTCL
    if {[string tolower $otbn1] == [string tolower $nick] || ( ![onchan me $chan] && [string tolower $otbn1] == "me" ) } {
      if {$botnet == ""} {
        putlog "!$nick ($host)! kick $chan $otbn1"
        putquick "KICK $chan $otbn1 :\0034You were kicked by \002\0033$nick\002"
        putquick "NOTICE $nick :\0033Sucessfully kicked you from $chan"

        if {$bcast == "1"} {
          putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to kick \002$otbn1\002 in $chan. Reason: N/A"
        }

        return 0
      }

      putlog "!$nick ($host)! kick $chan $otbn1 $botnet"
      putquick "KICK $chan $otbn1 :\0034You were kicked by \002\0033$nick\002\0034 for\0033 $botnet"
      putquick "NOTICE $nick :\0033Sucessfully kicked you from \0034$chan"

      if {$bcast == "1"} {
        putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to kick \002$otbn1\002 in $chan. Reason: $botnet."
      }

      return 0
    }

    if {[onchan $otbn1 $chan]} {
      set checkhand [nick2hand $otbn1 $chan]

      if {[validuser $checkhand]} {
        set hand2 $checkhand
      } else {
        set hand2 $otbn1
      }

      if {[checkaccess $handle $chan $hand2]} {
        if {$botnet == ""} {
          putlog "!$nick ($host)! kick $chan $otbn1"
          putquick "KICK $chan $otbn1 :\0034You were kicked by \0033\002$nick\002"
          putquick "NOTICE $nick :\0033Sucessfully kicked\0034 $otbn1\0033 from\0034 $chan"

          if {$bcast == "1"} {
            putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to kick \002$otbn1\002 in $chan. Reason: N/A"
          }

          return 0
        }

        putlog "!$nick ($host)! kick $chan $otbn1 $botnet"
        putquick "KICK $chan $otbn1 :\0034You were kicked by \0033\002$nick\002\0034 for\0033 $botnet"
        putquick "NOTICE $nick :\0033Sucessfully kicked\0034 $otbn1 \0033from\0034 $chan"

        if {$bcast == "1"} {
          putquick "PRIVMSG $home :\002$nick\002 ($host) requested me to kick \002$otbn1\002 in $chan. Reason: $botnet."
        }
  
        return 0
      }

      putquick "NOTICE $nick :\0034ERROR - Unable To Execute Command - Not Enough Permissions."
      putquick "NOTICE $otbn1 :\0034\002$nick\002 ($host) tried to make me kick you in $chan"

      if {$bcast == "1"} {
        putquick "PRIVMSG $home :\002$nick\002 ($host) tried to kick \002$otbn1\002 (a higher user than $nick) in $chan"
      }

      return 0
    }

    putquick "NOTICE $nick :\0034ERROR - $otbn1 not found on $chan"
  }
}